package com.zecan.blog.vo.user;

import com.zecan.blog.entity.UserCenterBlogInfo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;


@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserCenterBlogInfoVo {
    private Integer followCount;

    private Integer followerCount;

    private String enterTime;

    private Integer sendBlogCount;

    private Integer commentCount;

    private Integer userId;

    private String avatar;

    private String username;

    // 关注的用户集合
    private List<UserCenterBlogInfoVo> followList;

    // 粉丝用户集合
    private List<UserCenterBlogInfoVo> followerList;

    public static UserCenterBlogInfoVo getUserCenterBlogInfoVo(UserCenterBlogInfo info) {
        return builder().commentCount(
                info.getCommentCount() == null ? 0 : info.getCommentCount()).
                followCount(info.getFollowCount() == null ? 0 : info.getFollowCount()).
                followerCount(info.getFollowerCount() == null ? 0 : info.getFollowerCount()).
                sendBlogCount(info.getSendBlogCount() == null ? 0 : info.getSendBlogCount()).
                avatar(info.getAvatar()).userId(info.getUserId()).username(info.getUsername()).enterTime(info.getEnterTime()).build();
    }

}